/*
 Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 The JS file, without author permission, shall not be copied,
 published and spread, can not be used for commercial purposes
 @author Think Gem, Email: ThinkGem at 163.COM
 @version 2020-4-26
*/
var $jscomp = $jscomp || {};
$jscomp.scope = {};
$jscomp.findInternal = function(a, c, b) {
    a instanceof String && (a = String(a));
    for (var d = a.length, e = 0; e < d; e++) {
        var n = a[e];
        if (c.call(b, n, e, a))
            return {
                i: e,
                v: n
            }
    }
    return {
        i: -1,
        v: void 0
    }
}
;
$jscomp.ASSUME_ES5 = !1;
$jscomp.ASSUME_NO_NATIVE_MAP = !1;
$jscomp.ASSUME_NO_NATIVE_SET = !1;
$jscomp.SIMPLE_FROUND_POLYFILL = !1;
$jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function(a, c, b) {
    a != Array.prototype && a != Object.prototype && (a[c] = b.value)
}
;
$jscomp.getGlobal = function(a) {
    a = ["object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global, a];
    for (var c = 0; c < a.length; ++c) {
        var b = a[c];
        if (b && b.Math == Math)
            return b
    }
    throw Error("Cannot find global object");
}
;
$jscomp.global = $jscomp.getGlobal(this);
$jscomp.polyfill = function(a, c, b, d) {
    if (c) {
        b = $jscomp.global;
        a = a.split(".");
        for (d = 0; d < a.length - 1; d++) {
            var e = a[d];
            e in b || (b[e] = {});
            b = b[e]
        }
        a = a[a.length - 1];
        d = b[a];
        c = c(d);
        c != d && null != c && $jscomp.defineProperty(b, a, {
            configurable: !0,
            writable: !0,
            value: c
        })
    }
}
;
$jscomp.polyfill("Array.prototype.find", function(a) {
    return a ? a : function(a, b) {
        return $jscomp.findInternal(this, a, b).v
    }
}, "es6", "es3");
(function(a) {
        var c = function(b, c) {
            function d() {
                g.jqGrid(b);
                A.html(pageHtml({}));
                b.groupHeaders && b.groupHeaders.twoLevel && (b.groupHeaders.threeLevel ? g.jqGrid("setComplexHeaders", {
                    complexHeaders: {
                        defaultStyle: !0,
                        twoLevel: b.groupHeaders.twoLevel,
                        threeLevel: b.groupHeaders.threeLevel
                    }
                }) : g.jqGrid("setGroupHeaders", {
                    useColSpanStyle: !0,
                    groupHeaders: b.groupHeaders.twoLevel
                }));
                b.frozenCols && g.jqGrid("setFrozenColumns");
                g.jqGrid("initFormMore");
                window.dataGrids || (window.dataGrids = []);
                window.dataGrids.push(g);
                a(window).resizeEnd(function() {
                    window.dataGrids || (window.dataGrids = []);
                    for (var a in window.dataGrids)
                        window.dataGrids[a].dataGrid("resize")
                });
                w();
                g.on("jqGridRemapColumns", function() {
                    w()
                })
            }
            function n() {
                if (b.autoGridHeight) {
                    if ("function" == typeof b.autoGridHeight)
                        var c = b.autoGridHeight();
                    else {
                        c = a(g).height();
                        var y = a(g).parent();
                        0 != y.length && (c = y.height());
                        c = a(window).height() - a("body").height() + c - b.autoGridHeightFix;
                        200 > c && (c = 200);
                        y.height(c)
                    }
                    0 != c && g.jqGrid("setGridHeight", c)
                }
            }
            function f() {
                if (b.autoGridWidth) {
                    var c = 0;
                    if ("function" == typeof b.autoGridWidth)
                        c = b.autoGridWidth();
                    else {
                        var y = a(g).parents(".ui-jqgrid").parent();
                        y.is(":visible") && (c = y.width() - 2)
                    }
                    0 != c && g.jqGrid("setGridWidth", c - b.autoGridWidthFix, b.shrinkToFit && 500 < a(window).width())
                }
            }
            function w() {
                n();
                f();
                setTimeout(function() {
                    n();
                    f()
                }, navigator.userAgent.match(/MSIE 8.0/) ? 200 : 100)
            }
            function u(a, b, c) {
                0 != b.length && void 0 == b.attr("data-" + a + "-binded") && (b.attr("data-" + a + "-binded", !0),
                    b.bind(a, c))
            }
            function p(a) {
                return !a || "" == a || "0" == a
            }
            function k(a) {
                return g.jqGrid("getGridParam", a)
            }
            function x(a, b) {
                return g.jqGrid("setGridParam", a, b)
            }
            function z(a, c) {
                var l = {};
                a && (l.page = a,
                    b.inputPageNo.val(a));
                c && (l.rowNum = c,
                    b.inputPageSize.val(c));
                b.lazyLoad && (b.datatype = l.datatype = b.datatype_bak);
                x(l);
                B();
                return t
            }
            function B() {
                g.trigger("reloadGrid")
            }
            function F(a) {
                g.jqGrid("delTreeNode", a);
                return t
            }
            function q(b) {
                js.loading();
                setTimeout(function() {
                    g.expandLevel = b;
                    g.currentLevel = 1;
                    g.expandNodeIds = [];
                    a(".jqgrow:visible .tree-plus", g).each(function() {
                        var b = a(this).parents(".jqgrow")[0].id;
                        g.expandNodeIds.push(b)
                    });
                    100 < g.expandNodeIds.length ? (js.showMessage(a.jgrid.format(a.jgrid.extend.expandTooMany, g.expandNodeIds.length)),
                        g.expandNodeIds = []) : a("#" + g.expandNodeIds.shift() + ":visible .tree-plus", g).click();
                    for (var c = 0; c < g.expandLevel; c++)
                        a(".jqgrow:visible .tree-plus", g).click();
                    js.closeLoading()
                }, 10);
                return t
            }
            function v() {
                js.loading();
                setTimeout(function() {
                    a(".tree-minus", g).click();
                    js.closeLoading()
                }, 10);
                return t
            }
            function G(a, c) {
                a && (b.defaultExpandLevel = a);
                p(c) ? void 0 != c && (b.defaultExpandLevel = b.initExpandLevel) : x({
                    postData: {
                        id: c
                    }
                });
                B();
                return t
            }
            function D(a, b) {
                b && F(b);
                p(a) ? B() : "" != a && (a = g.find("#" + a + " .treeclick"),
                    0 < a.length ? a.dblclick() : B())
            }
            function E(b) {
                var c = a("#" + m + ">tbody>tr:gt(0)");
                a.each(b.split(","), function(b, l) {
                    var d = c.eq(0).children("[aria-describedby='" + m + "_" + l + "']")
                        , f = d.index()
                        , g = 1;
                    c.slice(1).each(function(b, c) {
                        b = a(c).children("td").eq(f);
                        d.text() === b.text() ? (g++,
                            b.hide()) : (d.attr("rowspan", g),
                            d = b,
                            g = 1);
                        d.attr("rowspan", g)
                    })
                })
            }
            function C(c, d) {
                c = c || b.editGridInputFormListName;
                d = d || b.editGridInputFormListAttrs;
                a.each(d.split(","), function(b, d) {
                    "" != (d = a.trim(d)) && (g.find(['[name="' + d + '"]:not(div,a,script)', '[name^="' + c + '["][name$="].' + d + '"]:not(div,a,script)'].join()).each(function(b, l) {
                        a(this).attr("name", c + "[" + b + "]." + d)
                    }),
                        g.find(['[name="!' + d + '"]:not(div,a,script)', '[name^="!' + c + '["][name$="].' + d + '"]:not(div,a,script)'].join()).each(function(b, l) {
                            a(this).attr("name", "!" + c + "[" + b + "]." + d)
                        }))
                })
            }
            var g = "undefined" != typeof c ? c : b.dataGrid ? b.dataGrid : a("#dataGrid")
                , m = g.attr("id")
                , A = b.dataGridPage ? b.dataGridPage : a("#" + m + "Page")
                , h = b.searchForm ? b.searchForm : b.url ? a() : a("#searchForm");
            c = b.dataId ? b.dataId : "id";
            b = a.extend({
                url: h.attr("action"),
                postData: h.serializeArray(),
                mtype: "POST",
                datatype: "json",
                jsonReader: {
                    id: c,
                    root: "list",
                    page: "pageNo",
                    userdata: "otherData",
                    total: "last",
                    records: "count",
                    subgrid: {
                        root: "list"
                    }
                },
                treeReader: {
                    level_field: "treeLevel",
                    parent_id_field: "parentCode",
                    userdata: "otherData",
                    leaf_field: "isTreeLeaf",
                    expanded_field: "isOpen",
                    icon_field: "_icon"
                },
                prmNames: {
                    page: "pageNo",
                    rows: "pageSize",
                    sort: "orderBy",
                    order: "sord",
                    search: "_search",
                    nd: "nd",
                    id: "id",
                    oper: "oper",
                    editoper: "edit",
                    addoper: "add",
                    deloper: "del",
                    subgridid: "id",
                    npage: null,
                    totalrows: "totalPage"
                },
                editurl: "clientArray",
                rowNum: -1,
                rownumWidth: 35,
                multiselectWidth: 28,
                altRows: !0,
                minColWidth: 35,
                subGridWidth: 23,
                autoencode: !0,
                columnModel: [],
                colNames: [],
                colModel: [],
                dataId: "id",
                lazyLoad: !1,
                shrinkToFit: !0,
                showRownum: !0,
                showCheckbox: !1,
                sortableColumn: !0,
                multiSort: !1,
                sortable: !0,
                emptyDataHint: !1,
                emptyDataHintContent: "<center>" + a.jgrid.defaults.emptyrecords + "</center>",
                autoGridHeight: !0,
                autoGridHeightFix: 0,
                autoGridWidth: !0,
                autoGridWidthFix: 0,
                btnSearch: a("#btnSearch"),
                btnRefreshTree: a("#btnRefreshTree"),
                btnExpandTreeNode: a("#btnExpandTreeNode"),
                btnCollapseTreeNode: a("#btnCollapseTreeNode"),
                btnSetting: a("#btnSetting"),
                editGrid: !1,
                editGridInitRowNum: 1,
                editGridInitAllRowEdit: !0,
                editGridAddRow: function(a) {
                    if ("new" == a || "init" == a)
                        g.jqGrid("addRow", {
                            position: "last",
                            addRowParams: {
                                keys: b.editGridAddRowKeys,
                                focusField: "new" == a
                            },
                            initdata: "function" == typeof b.editGridAddRowInitData ? b.editGridAddRowInitData(m) : b.editGridAddRowInitData
                        }),
                        "function" == typeof window.webuploaderRefresh && window.webuploaderRefresh()
                },
                editGridAddRowBtn: a("#" + m + "AddRowBtn"),
                editGridAddRowBtnToHeader: !1,
                editGridAddRowInitData: {},
                editGridAddRowKeys: !1,
                editGridInputForm: g.parents("form"),
                editGridInputFormListName: "",
                editGridInputFormListAttrs: "",
                treeGrid: !1,
                treeGridModel: "adjacency",
                treeColumn: null,
                ExpandColClick: !0,
                ExpandColumn: b.treeColumn,
                defaultExpandLevel: 0,
                initExpandLevel: b.defaultExpandLevel,
                expandNodeClearPostData: !1,
                inputPageNo: a("#pageNo", h),
                inputPageSize: a("#pageSize", h),
                inputOrderBy: a("#orderBy", h),
                beforeRequest: function(c) {
                    switch (b.datatype && b.datatype.toLowerCase()) {
                        case "json":
                        case "jsonp":
                        case "xml":
                        case "script":
                            if (void 0 == b.url || "" == b.url)
                                return js.showMessage("\u8bbe\u7f6esearchForm\u8868\u5355\u6307\u5b9a\u9519\u8bef\u6216URL\u4e3a\u7a7a\u3002"),
                                    !1
                    }
                    js.loading();
                    if (b.treeGrid) {
                        var d = k("postData");
                        if (d.id)
                            x({
                                postData: {
                                    id: d.id
                                }
                            });
                        else if (d.nodeid)
                            if (1 == b.expandNodeClearPostData)
                                x({
                                    postData: {
                                        parentCode: d.nodeid
                                    }
                                });
                            else {
                                var l = {};
                                a.each(h.serializeArray(), function(a, b) {
                                    l[b.name] = b.value
                                });
                                "string" == typeof b.expandNodeClearPostData && a.each(b.expandNodeClearPostData.split(","), function(a, b) {
                                    "" != b && (l[b] = "")
                                });
                                l.parentCode = d.nodeid;
                                x({
                                    postData: l
                                })
                            }
                        else
                            0 < h.length && (x({
                                postData: {}
                            }),
                                x({
                                    url: h.attr("action"),
                                    postData: h.serializeArray()
                                }))
                    } else
                        0 < h.length && (x({
                            postData: {}
                        }),
                            x({
                                url: h.attr("action"),
                                postData: h.serializeArray()
                            }));
                    "function" == typeof b.ajaxLoad && b.ajaxLoad(c);
                    a(".btn").attr("disabled", !0);
                    a(".ui-jqgrid .loading").remove()
                },
                loadComplete: function(c) {
                    1 <= A.length && c && (c.funcParam = m,
                        b.treeGrid ? void 0 == k("postData").parentCode && A.html(pageHtml(c)) : A.html(pageHtml(c)));
                    b.treeGrid && (g.expandNodeIds ? setTimeout(function() {
                        0 < g.expandNodeIds.length ? a("#" + g.expandNodeIds.shift() + ":visible .tree-plus", g).click() : g.currentLevel < g.expandLevel ? (g.currentLevel++,
                            g.expandNodeIds = [],
                            a(".jqgrow:visible .tree-plus", g).each(function() {
                                var b = a(this).parents(".jqgrow").attr("id");
                                g.expandNodeIds.push(b)
                            }),
                            a("#" + g.expandNodeIds.shift() + ":visible .tree-plus", g).click()) : g.expandNodeIds = null
                    }, 10) : b.defaultExpandLevel && 0 < b.defaultExpandLevel && (q(b.defaultExpandLevel),
                        b.defaultExpandLevel = 0),
                        x({
                            postData: {
                                id: "",
                                nodeid: ""
                            }
                        }));
                    b.editGrid && (a(function() {
                        var a = g.jqGrid("getDataIDs");
                        if (0 < a.length) {
                            if (1 == b.editGridInitAllRowEdit)
                                for (var c = 0; c < a.length; c++)
                                    g.jqGrid("editRow", a[c], {
                                        keys: b.editGridAddRowKeys,
                                        focusField: !1
                                    })
                        } else if (b.editGridInitRowNum && b.editGridAddRow)
                            for (c = 0; c < b.editGridInitRowNum; c++)
                                b.editGridAddRow("init");
                        "function" == typeof b.editGridInitRowSuccess && b.editGridInitRowSuccess(a)
                    }),
                    b.editGridAddRowBtnToHeader && 0 == a("#jqgh_" + m + "_rn .headerAddRowBtn").size() && a("#jqgh_" + m + "_rn").append('<a href="javascript:" class="headerAddRowBtn" onclick="$(\'#' + b.editGridAddRowBtn.attr("id") + '\').click();"><i class="fa fa-plus"></i></a>'));
                    if (b.emptyDataHint)
                        if (0 == g.jqGrid("getGridParam", "reccount")) {
                            if (0 == a("#jqgh_" + m + "_edh").size()) {
                                var d = "function" == typeof b.emptyDataHintContent ? b.emptyDataHintContent() : b.emptyDataHintContent;
                                g.parent().append('<div id="jqgh_' + m + '_edh" class="mt20 mb20">' + d + "</div>")
                            }
                        } else
                            a("#jqgh_" + m + "_edh").remove();
                    "function" == typeof b.ajaxSuccess && b.ajaxSuccess(c);
                    "function" == typeof b.btnEventBind && (b.btnEventBind(g.find(".btnList")),
                        b.btnEventBind(a("#" + m + "_frozen").find(".btnList")));
                    "function" == typeof b.btnMoreEventBind && (b.btnMoreEventBind(g.find(".btnMore")),
                        b.btnMoreEventBind(a("#" + m + "_frozen").find(".btnMore")));
                    c && c.message && js.showMessage(c.message);
                    a(".btn").attr("disabled", !1);
                    js.closeLoading()
                },
                loadError: function(c) {
                    "function" == typeof b.ajaxError && b.ajaxError(c);
                    a(".btn").attr("disabled", !1);
                    js.showErrorMessage(c.responseText);
                    js.closeLoading(0, !0)
                },
                gridComplete: function() {
                    "function" == typeof b.complete && b.complete();
                    w()
                },
                onSortCol: function(a, c, d) {
                    a && b.inputOrderBy && b.inputOrderBy.length ? b.inputOrderBy.val(a + " " + d) : b.inputOrderBy.val("")
                },
                btnEventBind: function(c) {
                    c.each(function() {
                        u("click", a(this), function() {
                            var c = a(this)
                                , d = c.data("href") || c.attr("href")
                                , f = c.data("title") || c.attr("title")
                                , l = c.data("confirm");
                            void 0 != l ? js.confirm(l, d, function(a) {
                                js.showMessage(a.message);
                                if (a.result == Global.TRUE)
                                    if (a = c.data("confirmSuccess"),
                                    void 0 != a)
                                        try {
                                            eval(a)
                                        } catch (H) {
                                            log("confirmSuccess error: " + H)
                                        }
                                    else
                                        b.treeGrid ? (a = c.data("deltreenode"),
                                            void 0 != a ? g.dataGrid("delTreeNode", a) : (a = g.jqGrid("getRowData", c.parents(".jqgrow").attr("id"))) && !p(a.parentCode) ? D(a.parentCode) : G()) : z()
                            }, "json") : js.addTabPage(a(this), f, d, b.tabPageId);
                            return !1
                        })
                    });
                    return t
                },
                btnMoreEventBind: function(b) {
                    b.each(function() {
                        var b;
                        u("mouseover", a(this), function() {
                            var c = g.closest(".ui-jqgrid-bdiv")
                                , d = a(this)
                                , f = d.next()
                                , l = d.position1x()
                                , e = l.top - f.height() / 2 + 6;
                            l = l.left;
                            if (f.hasClass("moreItems")) {
                                l = l + f.width() > c.position().left + c.width() - 80 ? l - f.width() : l + d.width();
                                g.find(".btnMore.open").removeClass("open").find("i").removeClass("fa-chevron-circle-left").addClass("fa-chevron-circle-right");
                                g.find(".moreItems.open").removeClass("open").hide();
                                var p = c.scrollTop() + 5;
                                e <= p ? e = p : (p = c.height() - f.height() + p - 12,
                                e >= p && (e = p));
                                d.addClass("open").find("i").removeClass("fa-chevron-circle-right").addClass("fa-chevron-circle-left");
                                f.addClass("open").css({
                                    top: e,
                                    left: l
                                }).show();
                                void 0 == f.attr("data-hover-binded") && (f.attr("data-hover-binded", !0),
                                    f.hover(function() {
                                        window.clearTimeout(b)
                                    }, function() {
                                        window.clearTimeout(b);
                                        b = window.setTimeout(function() {
                                            d.removeClass("open").find("i").removeClass("fa-chevron-circle-left").addClass("fa-chevron-circle-right");
                                            f.hide()
                                        }, 500)
                                    }).find("a").click(function() {
                                        d.removeClass("open").find("i").removeClass("fa-chevron-circle-left").addClass("fa-chevron-circle-right");
                                        f.hide()
                                    }))
                            }
                        })
                    });
                    return t
                },
                ajaxLoad: function(a) {},
                ajaxSuccess: function(a) {},
                ajaxError: function(a) {},
                complete: function() {}
            }, b);
            if (0 < b.columnModel.length) {
                b.colNames = [];
                b.colModel = [];
                c = 0;
                for (var r; c < b.columnModel.length; c++) {
                    r = b.columnModel[c];
                    r.header ? b.colNames.push(r.header) : r.label && b.colNames.push(r.label);
                    if (b.treeGrid || !b.sortableColumn)
                        r.sortable = !1;
                    b.colModel.push(r)
                }
            }
            if (b.treeGrid || !b.sortableColumn)
                for (c = 0; c < b.colModel.length; c++)
                    b.colModel[c].sortable = !1;
            b.treeGrid && (b.showRownum = !1);
            b.showRownum && (b.rownumbers = !0);
            b.showCheckbox && (b.multiselect = !0);
            "local" == b.datatype && -1 == b.rowNum && (b.rowNum = 5E3);
            b.lazyLoad && !b.treeGrid && (b.datatype_bak = b.datatype,
                b.datatype = "local");
            if (b.groupHeaders || b.frozenCols)
                b.sortable = !1;
            b.shrinkToFit = b.groupHeaders || b.frozenCols || !b.shrinkToFit ? !1 : !0;
            b.showFooter && (b.footerrow = !0,
                b.userDataOnFooter = !0);
            0 < h.length && (0 == b.inputPageNo.length && (c = h.data("pageNo"),
                h.append('<input id="pageNo" name="pageNo" type="hidden" value="' + (c ? c : "") + '"/>'),
                b.inputPageNo = a("#pageNo", h)),
            0 == b.inputPageSize.length && (c = h.data("pageSize"),
                h.append('<input id="pageSize" name="pageSize" type="hidden" value="' + (c ? c : "") + '"/>'),
                b.inputPageSize = a("#pageSize", h)),
            0 == b.inputOrderBy.length && (c = h.data("orderBy"),
                h.append('<input id="orderBy" name="orderBy" type="hidden" value="' + (c ? c : "") + '"/>'),
                b.inputOrderBy = a("#orderBy", h)),
                h.submit(function() {
                    z(1);
                    return !1
                }).on("reset", function() {
                    h.find(".isReset").each(function() {
                        a(this).val(a(this).data("defaultValue"))
                    });
                    setTimeout(function() {
                        void 0 !== a.fn.iCheck && h.find("input[type=checkbox].form-control:not(.noicheck),input[type=radio].form-control:not(.noicheck)").iCheck("update");
                        void 0 !== a.fn.select2 && h.find("select.form-control:not(.noselect2)").trigger("change")
                    }, 200)
                }),
                u("change", h.find(".isQuick"), function() {
                    h.submit()
                }),
            0 < b.btnSearch.length && (u("click", b.btnSearch, function() {
                var b = a(this);
                h.hasClass("hide") ? (h.removeClass("hide"),
                    b.addClass("active"),
                    b.html(b.find("i").prop("outerHTML") + " " + a.jgrid.extend.btnHideSearch)) : (h.addClass("hide"),
                    b.removeClass("active"),
                    b.html(b.find("i").prop("outerHTML") + " " + a.jgrid.extend.btnSearch));
                w();
                return !1
            }),
            h.hasClass("hide") || (c = b.btnSearch,
                c.addClass("active"),
                c.html(c.find("i").prop("outerHTML") + " " + a.jgrid.extend.btnHideSearch))),
            b.treeGrid && (u("click", b.btnRefreshTree, function() {
                h.each(function() {
                    this.reset()
                });
                0 == h.find(".isQuick").length && h.submit();
                return !1
            }),
                u("click", b.btnExpandTreeNode, function() {
                    q(1);
                    return !1
                }),
                u("click", b.btnCollapseTreeNode, function() {
                    v();
                    return !1
                })));
            "function" == typeof b.btnEventBind && b.btnEventBind(a(".btnTool"));
            0 < b.btnSetting.length && u("click", b.btnSetting, function() {
                g.jqGrid("columnChooser")
            });
            b.editGrid && (g.addClass("editgrid"),
                u("click", b.editGridAddRowBtn, function() {
                    b.editGridAddRow && b.editGridAddRow("new");
                    return !1
                }),
            b.editGridInputForm && 0 < b.editGridInputForm.length && "" != b.editGridInputFormListName && "" != b.editGridInputFormListAttrs && b.editGridInputForm.submit(function() {
                C()
            }));
            var t = {
                jqGrid: function(a, b, c, d, f, e) {
                    return g.jqGrid(a, b, c, d, f, e)
                },
                setParam: function(a, b) {
                    return x(a, b)
                },
                getParam: function(a) {
                    return k(a)
                },
                getDataIDs: function() {
                    return g.jqGrid("getDataIDs")
                },
                getRowData: function(a) {
                    return g.jqGrid("getRowData", a)
                },
                getSelectRow: function() {
                    return k("selrow")
                },
                getSelectRows: function() {
                    return k("selarrrow")
                },
                setSelectRow: function(a, b) {
                    void 0 == a && void 0 == b ? g.jqGrid("resetSelection") : void 0 != a && b ? g.jqGrid("resetSelection", a) : g.jqGrid("setSelection", a);
                    return t
                },
                resize: function() {
                    return w()
                },
                refresh: function(a, b) {
                    return z(a, b)
                },
                reloadGrid: function() {
                    return B()
                },
                delRowData: function(a) {
                    g.jqGrid("delRowData", a);
                    return t
                },
                delTreeNode: function(a) {
                    return F(a)
                },
                expandTreeNode: function(a) {
                    return q(a)
                },
                collapseTreeNode: function() {
                    v()
                },
                refreshTree: function(a, b) {
                    return G(a, b)
                },
                refreshTreeChildren: function(a, b) {
                    return D(a, b)
                },
                mergeCell: function(a) {
                    return E(a)
                },
                updateListFieldName: function(a, b) {
                    C(a, b)
                },
                initialize: function() {
                    d()
                }
            };
            return t
        };
        a.fn.dataGrid = function(b, d, e, n, f, w) {
            var u = this.each(function() {
                var p = a(this)
                    , k = p.data("dataGrid")
                    , u = "object" === typeof b && b;
                k || (k = new c(u,p),
                    p.data("dataGrid", k),
                    k.initialize());
                "string" === typeof b && "function" === typeof k[b] && (x = d instanceof Array ? k[b].apply(k, d, e, n, f, w) : k[b](d, e, n, f, w))
            });
            if (void 0 === x) {
                var p = a.jgrid.getMethod(b);
                if (p) {
                    var k = a.makeArray(arguments).slice(1);
                    var x = p.apply(this, k)
                }
            }
            return void 0 === x ? u : x
        }
        ;
        a.extend(a.jgrid, {
            stripHtml: function(a) {
                a = String(a);
                return a.replace(/<[^>]*>/g, "")
            }
        })
    }
)(jQuery);
function page(a, c, b) {
    try {
        b && "" != b ? $("#" + b).dataGrid("refresh", a, c) : $(".ui-jqgrid-btable:eq(0)").dataGrid("refresh", a, c)
    } catch (d) {}
    return !1
}
function pageHtml(a) {
    a.pageNo || (a.pageNo = 1);
    a.pageSize || (a.pageSize = 20);
    a.count || (a.count = 0);
    a.bothNum || (a.bothNum = 1);
    a.centerNum || (a.centerNum = 5);
    a.funcName || (a.funcName = "page");
    a.funcParam || (a.funcParam = "");
    a.pageInfo || (a.pageInfo = "");
    0 >= a.pageSize && (a.pageSize = 20);
    a.first = 1;
    a.last = parseInt(a.count / a.pageSize) + a.first - 1;
    0 == a.count % a.pageSize && 0 != a.last || a.last++;
    a.last < a.first && (a.last = a.first);
    a.pageNo <= a.first && (a.pageNo = a.first);
    a.pageNo >= a.last && (a.pageNo = a.last);
    a.prev = 1 < a.pageNo ? a.pageNo - 1 : a.first;
    a.next = a.pageNo < a.last - 1 ? a.pageNo + 1 : a.last;
    a.centerBegin = a.pageNo - parseInt(a.centerNum / 2);
    a.centerBegin < a.first && (a.centerBegin = a.first);
    a.centerEnd = a.centerBegin + a.centerNum - 1;
    a.centerEnd >= a.last && (a.centerEnd = a.last,
        a.centerBegin = a.centerEnd - a.centerNum + 1);
    a.centerBegin == a.first && (a.centerEnd += a.bothNum);
    a.centerEnd == a.last && (a.centerBegin -= a.bothNum);
    a.last - a.centerEnd > a.bothNum || a.centerBegin--;
    a.centerBegin < a.first && (a.centerBegin = a.first);
    var c = ['<ul class="pagination">\n'], b;
    a.pageNo == a.first ? c.push('<li class="disabled"><a href="javascript:"><i class="fa fa-angle-left"></i></a></li>\n') : c.push('<li><a href="javascript:" onclick="' + a.funcName + "(" + a.prev + "," + a.pageSize + ",'" + a.funcParam + '\');"> <i class="fa fa-angle-left"></i></a></li>\n');
    for (b = a.first; b < a.first + a.bothNum && b < a.centerBegin; b++)
        c.push('<li><a href="javascript:" onclick="' + a.funcName + "(" + b + "," + a.pageSize + ",'" + a.funcParam + "');\">" + (b + 1 - a.first) + "</a></li>\n");
    b < a.centerBegin ? c.push('<li class="disabled"><a href="javascript:">...</a></li>\n') : a.centerEnd++;
    a.centerEnd > a.last && (a.centerEnd = a.last);
    for (b = a.centerBegin; b <= a.centerEnd; b++)
        b == a.pageNo ? c.push('<li class="active"><a href="javascript:">' + (b + 1 - a.first) + "</a></li>\n") : c.push('<li><a href="javascript:" onclick="' + a.funcName + "(" + b + "," + a.pageSize + ",'" + a.funcParam + "');\">" + (b + 1 - a.first) + "</a></li>\n");
    a.last - a.centerEnd > a.bothNum && (c.push('<li class="disabled"><a href="javascript:">...</a></li>\n'),
        a.centerEnd = a.last - a.bothNum);
    for (b = a.centerEnd + 1; b <= a.last; b++)
        c.push('<li><a href="javascript:" onclick="' + a.funcName + "(" + b + "," + a.pageSize + ",'" + a.funcParam + "');\">" + (b + 1 - a.first) + "</a></li>\n");
    a.pageNo == a.last ? c.push('<li class="disabled"><a href="javascript:"><i class="fa fa-angle-right"></i></a></li>\n') : c.push('<li><a href="javascript:" onclick="' + a.funcName + "(" + a.next + "," + a.pageSize + ",'" + a.funcParam + '\');"><i class="fa fa-angle-right"></i></a></li>\n');
    c.push("</ul>\n");
    c.push(pageHtmlControl(a));
    c.push('<div style="clear:both;"></div>');
    return c.join("")
}
function pageHtmlControl(a) {
    var c = ['<ul class="pagination">\n'];
    c.push('<li class="disabled controls" title="' + $.jgrid.extend.pageTitle + '">' + $.jgrid.extend.pageLabelA + " ");
    c.push('<input type="text" value="' + a.pageNo + '" onkeyup="this.value=this.value.replace(/[^0-9]+/,\'\')" onkeypress="var e=window.event||event;var c=e.keyCode||e.which;if(c==13)');
    c.push(a.funcName + "(this.value," + a.pageSize + ",'" + a.funcParam + '\');" onclick="this.select();"/> ' + $.jgrid.extend.pageLabelB + " ");
    c.push('<input type="text" value="' + a.pageSize + '" onkeyup="this.value=this.value.replace(/[^0-9]+/,\'\')" onkeypress="var e=window.event||event;var c=e.keyCode||e.which;if(c==13)');
    c.push(a.funcName + "(" + a.pageNo + ",this.value,'" + a.funcParam + '\');" onclick="this.select();"/> ');
    c.push($.jgrid.format($.jgrid.extend.pageLabelC, a.count));
    c.push((a.pageInfo && "" != a.pageInfo ? a.pageInfo : "") + "</li>\n");
    c.push("</ul>\n");
    return c.join("")
}
(function(a) {
        a.jgrid.extend({
            initFormMore: function() {
                this.each(function() {
                    var c = a(this)
                        , b = c.getGridParam("searchForm");
                    if (b && 0 < b.size()) {
                        var d = b.find(".btnFormMore")
                            , e = b.find(".form-more");
                        d.click(function() {
                            e.is(":hidden") ? e.slideDown(50) : e.slideUp(50)
                        });
                        c.bind("jqGridLoadComplete", function() {
                            e.slideUp(50)
                        })
                    }
                })
            },
            getIdsByLevel: function(a) {
                var b = [];
                this.each(function() {
                    if (this.grid && this.p.treeGrid)
                        for (var c = this.p.treeReader.leaf_field, e = this.p.treeReader.level_field, n = this.p.data, f = 0; f < n.length; f++)
                            n[f][c] || n[f][e] != a || b.push(n[f]._id_)
                });
                return b
            },
            delTreeChildNode: function(c) {
                return this.each(function() {
                    var b = this.p.localReader.id
                        , d = this.p.treeReader.loaded;
                    if (this.grid && this.p.treeGrid) {
                        var e = this.p._index[c];
                        if (void 0 !== e) {
                            var n = this.p.data[e]
                                , f = a(this).jqGrid("getNodeChildren", n);
                            if (0 < f.length)
                                for (e = 0; e < f.length; e++)
                                    a(this).jqGrid("delRowData", f[e][b]);
                            a(this).jqGrid("collapseRow", n);
                            a(this).jqGrid("collapseNode", n);
                            n[d] = void 0
                        }
                    }
                })
            }
        })
    }
)(jQuery);
(function(a) {
        a.jgrid.extend({
            setComplexHeaders: function(c) {
                c = a.extend({
                    complexHeaders: {
                        defaultStyle: !0,
                        threeLevel: [],
                        twoLevel: []
                    }
                }, c || {});
                return this.each(function() {
                    var b = c.complexHeaders
                        , d = b.threeLevel
                        , e = b.twoLevel;
                    if (0 !== d.length && 0 !== e.length) {
                        this.p.complexHeader = c;
                        var n = void 0 === b.defaultStyle ? !0 : b.defaultStyle, f, w = 0, u = 0, p = !1, k, x = this.p.colModel, z = x.length, B = this.grid.headers;
                        b = a("table.ui-jqgrid-htable", this.grid.hDiv);
                        var F = b.children("thead").children("tr.ui-jqgrid-labels:last").addClass("jqg-second-row-header");
                        var q = b.children("thead");
                        var v = b.find(".jqg-first-row-header");
                        void 0 === v[0] ? v = a("<tr>", {
                            role: "row",
                            "aria-hidden": "true"
                        }).addClass("jqg-first-row-header").css("height", "auto") : v.empty();
                        var G = function(a, b) {
                            for (var c = 0, d = b.length; c < d; c++)
                                if (b[c] && b[c].startColumnName === a)
                                    return c;
                            return -1
                        };
                        a(this).prepend(q);
                        q = a("<tr>", {
                            role: "rowheader"
                        }).addClass("ui-jqgrid-labels jqg-third-row-header");
                        var D = a("<tr>", {
                            role: "rowheader"
                        }).addClass("ui-jqgrid-labels jqg-four-row-header");
                        for (f = 0; f < z; f++) {
                            var E = B[f].el;
                            var C = a(E);
                            var g = x[f];
                            var m = {
                                height: "0px",
                                width: B[f].width + "px",
                                display: g.hidden ? "none" : ""
                            };
                            a("<th>", {
                                role: "gridcell"
                            }).css(m).addClass("ui-first-th-" + this.p.direction).appendTo(v);
                            E.style.width = "";
                            m = G(g.name, d);
                            if (0 <= m) {
                                var A = d[m];
                                var h = parseInt(A.numberOfColumns, 10);
                                var r = A.titleText;
                                for (m = k = 0; m < h && f + m < z; m++)
                                    x[f + m].hidden || k++;
                                r = a("<th>").attr({
                                    role: "columnheader",
                                    noWrap: !0
                                }).addClass("ui-state-default ui-th-column-header ui-th-" + this.p.direction + " " + (A.classes || "")).html(r);
                                0 < k && r.attr("colspan", String(k));
                                this.p.headertitles && r.attr("title", r.text());
                                0 === k && r.hide();
                                C.before(r);
                                w = h;
                                if (!1 === n)
                                    for (p = !1,
                                             k = 0; k < w && k + f < z; k++)
                                        if (m = G(x[k + f].name, e),
                                        0 <= m) {
                                            A = e[m];
                                            h = parseInt(A.numberOfColumns, 10);
                                            for (m = 0; m < h && k + f + m < z; m++)
                                                if (!x[k + f + m].hidden) {
                                                    p = !0;
                                                    break
                                                }
                                            if (!0 === p)
                                                break
                                        }
                            }
                            g = G(g.name, e);
                            if (0 < w && 0 <= g) {
                                A = e[g];
                                h = parseInt(A.numberOfColumns, 10);
                                r = A.titleText;
                                for (m = k = 0; m < h && f + m < z; m++)
                                    x[f + m].hidden || k++;
                                r = a("<th>").attr({
                                    role: "columnheader",
                                    noWrap: !0
                                }).addClass("ui-state-default ui-th-column-header ui-th-" + this.p.direction).html(r);
                                0 < k && r.attr("colspan", String(k));
                                this.p.headertitles && r.attr("title", r.text());
                                0 === k && r.hide();
                                q.append(r);
                                u = h
                            }
                            0 === w ? (C.attr("rowspan", "3"),
                                u = 0) : 0 < w && 0 === u ? (n ? (C.attr("rowspan", "2"),
                                q.append(E)) : p ? (C.attr("rowspan", "2"),
                                q.append(E)) : (r.attr("rowspan", "2"),
                                D.append(E)),
                                w--) : 0 < w && 0 < u && (D.append(E),
                                w--,
                                u--)
                        }
                        d = a(this).children("thead");
                        d.prepend(v);
                        q.insertAfter(F);
                        D.insertAfter(q);
                        b.append(d);
                        b.find("span.ui-jqgrid-resize").each(function() {
                            var b = a(this).parent();
                            b.is(":visible") && (this.style.cssText = "height: " + b.height() + "px !important; cursor: col-resize;")
                        });
                        b.find("div.ui-jqgrid-sortable").each(function() {
                            var b = a(this)
                                , c = b.parent();
                            c.is(":visible") && c.is(":has(span.ui-jqgrid-resize)") && b.css("top", (c.height() - b.outerHeight()) / 2 + "px")
                        });
                        var t = d.find("tr.jqg-first-row-header");
                        a(this).bind("jqGridResizeStop.setGroupHeaders", function(a, b, c) {
                            t.find("th").eq(c).width(b)
                        })
                    }
                })
            },
            createFrozenHtable: function(c, b) {
                var d = this[0], e = d.p.complexHeader.complexHeaders, n = e.defaultStyle, f = e.threeLevel, w = e.twoLevel, u = d.p.id, p = d.p.colModel, k = c + 1, x = d.grid.headers, z = 0, B = 0, F = !1, q, v;
                e = d.grid.fhDiv.height();
                var G = a("<table class='ui-jqgrid-htable' style='width:1px;height:" + e + "px' role='grid' aria-labelledby='gbox_" + u + "' cellspacing='0' cellpadding='0' border='0'></table>")
                    , D = a("<thead></thead>")
                    , E = a("<tr>", {
                    role: "row",
                    "aria-hidden": "true"
                }).addClass("jqg-first-row-header").css("height", "auto")
                    , C = a("<tr>", {
                    role: "rowheader"
                }).addClass("ui-jqgrid-labels jqg-second-row-header")
                    , g = a("<tr>", {
                    role: "rowheader"
                }).addClass("ui-jqgrid-labels jqg-third-row-header")
                    , m = a("<tr>", {
                    role: "rowheader"
                }).addClass("ui-jqgrid-labels jqg-four-row-header")
                    , A = function(a, b) {
                    for (var c = 0, d = b.length; c < d; c++)
                        if (b[c] && b[c].startColumnName === a)
                            return c;
                    return -1
                };
                for (q = 0; q < k; q++) {
                    var h = p[q];
                    var r = h.name;
                    r = a("#" + u + "_" + r, b);
                    var t = {
                        height: "0px",
                        width: x[q].width + "px",
                        display: h.hidden ? "none" : ""
                    };
                    a("<th>", {
                        role: "gridcell"
                    }).css(t).addClass("ui-first-th-" + d.p.direction).appendTo(E);
                    t = A(h.name, f);
                    if (0 <= t) {
                        var l = f[t];
                        t = parseInt(l.numberOfColumns, 10);
                        t + q - 1 > c && (t = c - q + 1);
                        var y = l.titleText;
                        for (l = v = 0; l < t && q + l < k; l++)
                            p[q + l].hidden || v++;
                        y = a("<th>").attr({
                            role: "columnheader",
                            noWrap: !0
                        }).addClass("ui-state-default ui-th-column-header ui-th-" + d.p.direction).html(y);
                        0 < v && y.attr("colspan", String(v));
                        d.p.headertitles && y.attr("title", y.text());
                        0 === v && y.hide();
                        y.appendTo(C);
                        z = t;
                        if (!1 === n)
                            for (F = !1,
                                     v = 0; v < z && v + q < k; v++) {
                                t = A(p[v + q].name, w);
                                if (0 <= t)
                                    for (l = w[t],
                                             t = parseInt(l.numberOfColumns, 10),
                                         t + v + q - 1 > c && (t = c - (v + q) + 1),
                                             l = 0; l < t && v + q + l < k; l++)
                                        if (!p[v + q + l].hidden) {
                                            F = !0;
                                            break
                                        }
                                if (!0 === F)
                                    break
                            }
                    }
                    h = A(h.name, w);
                    if (0 < z && 0 <= h) {
                        l = w[h];
                        t = parseInt(l.numberOfColumns, 10);
                        t + q - 1 > c && (t = c - q + 1);
                        y = l.titleText;
                        for (l = v = 0; l < t && q + l < k; l++)
                            p[q + l].hidden || v++;
                        y = a("<th>").attr({
                            role: "columnheader",
                            noWrap: !0
                        }).addClass("ui-state-default ui-th-column-header ui-th-" + d.p.direction).html(y);
                        0 < v && y.attr("colspan", String(v));
                        d.p.headertitles && y.attr("title", y.text());
                        0 === v && y.hide();
                        y.appendTo(g);
                        B = t
                    }
                    0 === z ? (r.attr("rowspan", "3"),
                        r.appendTo(C),
                        B = 0) : 0 < z && 0 === B ? (n ? (r.attr("rowspan", "2"),
                        r.appendTo(g)) : F ? (r.attr("rowspan", "2"),
                        r.appendTo(g)) : (y.attr("rowspan", "2"),
                        r.appendTo(m)),
                        z--) : 0 < z && 0 < B && (r.appendTo(m),
                        z--,
                        B--)
                }
                c = g.children().length;
                b = m.children().length;
                0 === c && 0 === b && C.height(e);
                n ? 0 < c && 0 === b && g.height(e - 23) : 0 === c && 0 < b && (C.height(e - 23),
                    C.find("th").each(function() {
                        var b = a(this).attr("rowspan");
                        b && a(this).attr("rowspan", String(parseInt(b, 10) - 1))
                    }));
                E.appendTo(D);
                C.appendTo(D);
                c && g.appendTo(D);
                b && m.appendTo(D);
                D.appendTo(G);
                return G
            }
        })
    }
)(jQuery);
(function(a) {
        a.jgrid.msie && 8 === a.jgrid.msiever() && (a.expr[":"].hidden = function(a) {
                return 0 === a.offsetWidth || 0 === a.offsetHeight || "none" === a.style.display
            }
        );
        a.jgrid.extend({
            sortableColumns: function(c) {
                return this.each(function() {
                    function b() {
                        d.p.disableClick = !0
                    }
                    var d = this
                        , e = a.jgrid.jqID(d.p.id);
                    e = {
                        tolerance: "pointer",
                        axis: "x",
                        scrollSensitivity: "1",
                        items: ">th:not(:has(#jqgh_" + e + "_cb,#jqgh_" + e + "_rn,#jqgh_" + e + "_subgrid),:hidden)",
                        placeholder: {
                            element: function(b) {
                                return a(document.createElement(b[0].nodeName)).addClass(b[0].className + " ui-sortable-placeholder ui-state-highlight").removeClass("ui-sortable-helper")[0]
                            },
                            update: function(a, b) {
                                b.height(a.currentItem.innerHeight() - parseInt(a.currentItem.css("paddingTop") || 0, 10) - parseInt(a.currentItem.css("paddingBottom") || 0, 10));
                                b.width(a.currentItem.innerWidth() - parseInt(a.currentItem.css("paddingLeft") || 0, 10) - parseInt(a.currentItem.css("paddingRight") || 0, 10))
                            }
                        },
                        update: function(b, c) {
                            b = a(c.item).parent();
                            b = a(">th", b);
                            var f = {}
                                , e = d.p.id + "_";
                            a.each(d.p.colModel, function(b) {
                                f[a.jgrid.jqID((this.name || "") + "_" + (this.header || this.name || ""))] = b
                            });
                            var k = [];
                            b.each(function() {
                                var b = a(">div", this).get(0).id.replace(/^jqgh_/, "").replace(e, "");
                                b = a.jgrid.jqID(b + "_" + (a(">div", this).text().trim() || b || ""));
                                f.hasOwnProperty(b) && k.push(f[b])
                            });
                            a(d).jqGrid("remapColumns", k, !0, !0);
                            a.isFunction(d.p.sortable.update) && d.p.sortable.update(k);
                            setTimeout(function() {
                                d.p.disableClick = !1
                            }, 50)
                        }
                    };
                    d.p.sortable.options ? a.extend(e, d.p.sortable.options) : a.isFunction(d.p.sortable) && (d.p.sortable = {
                        update: d.p.sortable
                    });
                    if (e.start) {
                        var n = e.start;
                        e.start = function(a, c) {
                            b();
                            n.call(this, a, c)
                        }
                    } else
                        e.start = b;
                    d.p.sortable.exclude && (e.items += ":not(" + d.p.sortable.exclude + ")");
                    e = c.sortable(e);
                    e = e.data("sortable") || e.data("uiSortable");
                    null != e && (e.data("sortable").floating = !0)
                })
            },
            columnChooser: function(c) {
                var b = this
                    , d = b[0].p
                    , e = {}
                    , n = d.colModel
                    , f = d.colNames;
                layer.open({
                    type: 1,
                    shade: .01,
                    shadeClose: !0,
                    area: ["500px", "300px"],
                    title: a.jgrid.col.caption,
                    scrollbar: !0,
                    id: "sort-column",
                    content: '<div class="sort-column"></div>',
                    success: function(b, c) {
                        (500 > a(layer.window).width() || 300 > a(layer.window).height()) && layer.full(c);
                        var p = b.find(".sort-column");
                        a.each(n, function(b) {
                            e[a.jgrid.jqID(this.name + "_" + f[b])] = b;
                            d.frozenCols && this.frozen || this.hidedlg || p.append('<span class="icheck" data-name="' + this.name + '" data-header="' + this.header + '"><label><input type="checkbox" ' + (this.hidden ? "" : "checked") + ' value="' + b + '"/>' + this.header + '</label><i class="fa fa-arrows" style="color:#ccc;cursor:move"></i></span>')
                        });
                        p.find(".icheck").iCheck();
                        p.sortable && p.sortable({
                            connectWith: ".icheck",
                            handle: "i",
                            placeholder: "icheck"
                        })
                    },
                    btn: ['<i class="fa fa-check"></i> ' + a.jgrid.col.bSubmit, '<i class="fa fa-remove"></i> ' + a.jgrid.col.bCancel],
                    btn1: function(c, d) {
                        d.find(".icheck").each(function(c) {
                            c = a(this);
                            var d = c.data();
                            c.find("input").is(":checked") ? b.jqGrid("showCol", a.jgrid.jqID(d.name + "_" + d.header), !0) : b.jqGrid("hideCol", a.jgrid.jqID(d.name + "_" + d.header), !0)
                        });
                        var p = [];
                        d.find(".icheck input:checked").each(function() {
                            p.push(parseInt(this.value, 10))
                        });
                        a.each(p, function() {
                            delete e[a.jgrid.jqID(n[this].name + "_" + f[this])]
                        });
                        a.each(e, function() {
                            var a = parseInt(this, 10);
                            var b = p
                                , c = a;
                            if (0 <= c) {
                                var d = b.slice();
                                var f = d.splice(c, Math.max(b.length - c, c));
                                c > b.length && (c = b.length);
                                d[c] = a;
                                p = d.concat(f)
                            } else
                                p = b
                        });
                        b.jqGrid("remapColumns", p, !0)
                    }
                })
            },
            sortableRows: function(c) {
                return this.each(function() {
                    var b = this;
                    b.grid && !b.p.treeGrid && a.fn.sortable && (c = a.extend({
                        cursor: "move",
                        axis: "y",
                        items: ".jqgrow"
                    }, c || {}),
                        c.start && a.isFunction(c.start) ? (c._start_ = c.start,
                            delete c.start) : c._start_ = !1,
                        c.update && a.isFunction(c.update) ? (c._update_ = c.update,
                            delete c.update) : c._update_ = !1,
                        c.start = function(d, e) {
                            a(e.item).css("border-width", "0");
                            a("td", e.item).each(function(a) {
                                this.style.width = b.grid.cols[a].style.width
                            });
                            if (b.p.subGrid) {
                                var n = a(e.item).attr("id");
                                try {
                                    a(b).jqGrid("collapseSubGridRow", n)
                                } catch (f) {}
                            }
                            c._start_ && c._start_.apply(this, [d, e]);
                            a(b).triggerHandler("jqGridSortableRowsStart")
                        }
                        ,
                        c.update = function(d, e) {
                            a(e.item).css("border-width", "");
                            !0 === b.p.rownumbers && a("td.jqgrid-rownum", b.rows).each(function(c) {
                                a(this).html(c + 1 + (parseInt(b.p.page, 10) - 1) * parseInt(b.p.rowNum, 10))
                            });
                            c._update_ && c._update_.apply(this, [d, e]);
                            a(b).triggerHandler("jqGridSortableRowsUpdate")
                        }
                        ,
                        a("tbody:first", b).sortable(c))
                })
            },
            gridDnD: function(c) {
                return this.each(function() {
                    function b() {
                        var b = a.data(d, "dnd");
                        a("tr.jqgrow:not(.ui-draggable)", d).draggable(a.isFunction(b.drag) ? b.drag.call(a(d), b) : b.drag)
                    }
                    var d = this, e;
                    if (d.grid && !d.p.treeGrid && a.fn.draggable && a.fn.droppable)
                        if (void 0 === a("#jqgrid_dnd")[0] && a("body").append("<table id='jqgrid_dnd' class='ui-jqgrid-dnd'></table>"),
                        "string" === typeof c && "updateDnD" === c && !0 === d.p.jqgdnd)
                            b();
                        else if (c = a.extend({
                            drag: function(b) {
                                return a.extend({
                                    start: function(c, e) {
                                        if (d.p.subGrid) {
                                            var f = a(e.helper).attr("id");
                                            try {
                                                a(d).jqGrid("collapseSubGridRow", f)
                                            } catch (k) {}
                                        }
                                        for (f = 0; f < a.data(d, "dnd").connectWith.length; f++)
                                            0 === a(a.data(d, "dnd").connectWith[f]).jqGrid("getGridParam", "reccount") && a(a.data(d, "dnd").connectWith[f]).jqGrid("addRowData", "jqg_empty_row", {});
                                        e.helper.addClass("ui-state-highlight");
                                        a("td", e.helper).each(function(a) {
                                            this.style.width = d.grid.headers[a].width + "px"
                                        });
                                        b.onstart && a.isFunction(b.onstart) && b.onstart.call(a(d), c, e)
                                    },
                                    stop: function(c, e) {
                                        if (e.helper.dropped && !b.dragcopy) {
                                            var f = a(e.helper).attr("id");
                                            void 0 === f && (f = a(this).attr("id"));
                                            a(d).jqGrid("delRowData", f)
                                        }
                                        for (f = 0; f < a.data(d, "dnd").connectWith.length; f++)
                                            a(a.data(d, "dnd").connectWith[f]).jqGrid("delRowData", "jqg_empty_row");
                                        b.onstop && a.isFunction(b.onstop) && b.onstop.call(a(d), c, e)
                                    }
                                }, b.drag_opts || {})
                            },
                            drop: function(b) {
                                return a.extend({
                                    accept: function(b) {
                                        if (!a(b).hasClass("jqgrow"))
                                            return b;
                                        b = a(b).closest("table.ui-jqgrid-btable");
                                        return 0 < b.length && void 0 !== a.data(b[0], "dnd") ? (b = a.data(b[0], "dnd").connectWith,
                                            -1 !== a.inArray("#" + a.jgrid.jqID(this.id), b) ? !0 : !1) : !1
                                    },
                                    drop: function(c, e) {
                                        if (a(e.draggable).hasClass("jqgrow")) {
                                            var f = a(e.draggable).attr("id");
                                            f = e.draggable.parent().parent().jqGrid("getRowData", f);
                                            if (!b.dropbyname) {
                                                var k = 0, n = {}, z, w = a("#" + a.jgrid.jqID(this.id)).jqGrid("getGridParam", "colModel");
                                                try {
                                                    for (z in f)
                                                        if (f.hasOwnProperty(z)) {
                                                            var u = w[k].name;
                                                            "cb" !== u && "rn" !== u && "subgrid" !== u && f.hasOwnProperty(z) && w[k] && (n[u] = f[z]);
                                                            k++
                                                        }
                                                    f = n
                                                } catch (v) {}
                                            }
                                            e.helper.dropped = !0;
                                            b.beforedrop && a.isFunction(b.beforedrop) && (u = b.beforedrop.call(this, c, e, f, a("#" + a.jgrid.jqID(d.p.id)), a(this)),
                                            void 0 !== u && null !== u && "object" === typeof u && (f = u));
                                            if (e.helper.dropped) {
                                                if (b.autoid)
                                                    if (a.isFunction(b.autoid))
                                                        var q = b.autoid.call(this, f);
                                                    else
                                                        q = Math.ceil(1E3 * Math.random()),
                                                            q = b.autoidprefix + q;
                                                a("#" + a.jgrid.jqID(this.id)).jqGrid("addRowData", q, f, b.droppos)
                                            }
                                            b.ondrop && a.isFunction(b.ondrop) && b.ondrop.call(this, c, e, f)
                                        }
                                    }
                                }, b.drop_opts || {})
                            },
                            onstart: null,
                            onstop: null,
                            beforedrop: null,
                            ondrop: null,
                            drop_opts: {
                                activeClass: "ui-state-active",
                                hoverClass: "ui-state-hover"
                            },
                            drag_opts: {
                                revert: "invalid",
                                helper: "clone",
                                cursor: "move",
                                appendTo: "#jqgrid_dnd",
                                zIndex: 5E3
                            },
                            dragcopy: !1,
                            dropbyname: !1,
                            droppos: "first",
                            autoid: !0,
                            autoidprefix: "dnd_"
                        }, c || {}),
                            c.connectWith)
                            for (c.connectWith = c.connectWith.split(","),
                                     c.connectWith = a.map(c.connectWith, function(b) {
                                         return a.trim(b)
                                     }),
                                     a.data(d, "dnd", c),
                                 0 === d.p.reccount || d.p.jqgdnd || b(),
                                     d.p.jqgdnd = !0,
                                     e = 0; e < c.connectWith.length; e++) {
                                var n = c.connectWith[e];
                                a(n).droppable(a.isFunction(c.drop) ? c.drop.call(a(d), c) : c.drop)
                            }
                })
            },
            gridResize: function(c) {
                return this.each(function() {
                    var b = this
                        , d = a.jgrid.jqID(b.p.id);
                    b.grid && a.fn.resizable && (c = a.extend({}, c || {}),
                        c.alsoResize ? (c._alsoResize_ = c.alsoResize,
                            delete c.alsoResize) : c._alsoResize_ = !1,
                        c.stop && a.isFunction(c.stop) ? (c._stop_ = c.stop,
                            delete c.stop) : c._stop_ = !1,
                        c.stop = function(e, n) {
                            a(b).jqGrid("setGridParam", {
                                height: a("#gview_" + d + " .ui-jqgrid-bdiv").height()
                            });
                            a(b).jqGrid("setGridWidth", n.size.width, c.shrinkToFit);
                            c._stop_ && c._stop_.call(b, e, n)
                        }
                        ,
                        c.alsoResize = c._alsoResize_ ? eval("({'#gview_" + (d + " .ui-jqgrid-bdiv':true,'" + c._alsoResize_ + "':true})")) : a(".ui-jqgrid-bdiv", "#gview_" + d),
                        delete c._alsoResize_,
                        a("#gbox_" + d).resizable(c))
                })
            }
        })
    }
)(jQuery);
